# -*- coding: utf-8 -*-

from flask import Blueprint, jsonify
from flask import current_app

route_map_bp = Blueprint('route_map', __name__)


@route_map_bp.get('/')
def route_map():
    """
    主视图，返回所有视图网址
    """
    rules_iterator = current_app.url_map.iter_rules()
    return jsonify({rule.endpoint: rule.rule for rule in rules_iterator if rule.endpoint not in ('route_map', 'static')})
